package org.zh.sh.sv;

import org.zh.sh.entity.Curriculum;
import org.zh.sh.util.jdbc.ZHOpenJdbcUtil;
import org.zh.sh.util.proxy.Service;
import org.zh.sh.util.jdbc.Transaction;

import java.util.Map;

import static org.zh.sh.util.Utils.removeEmpty;

@Service
public class CurriculumSV extends Curriculum {

    @Transaction
    public Map<String, Object> insert(Map<String, Object> curriculum)  {
        return ZHOpenJdbcUtil.insertPri(tableName,removeEmpty(curriculum));
    }

    @Transaction
    public void insertVoid(Map<String, Object> curriculum) {
         ZHOpenJdbcUtil.insertVoid(tableName,removeEmpty(curriculum));
    }
    @Transaction
    public int updateById(Map<String, Object> curriculum)  {
      return  ZHOpenJdbcUtil.executeUpdate(updateAll,curriculum.get(curriculumCreateTime),curriculum.get(curriculumEndTime),curriculum.get(curriculumName),curriculum.get(teacherId),curriculum.get(curriculumId));
    }

    @Transaction(readOnly = true)
    public Map<String, Object> queryById(Long id) {
        return  ZHOpenJdbcUtil.executeQueryOne(queryById,id);
    }

    @Transaction
    public int deleteById(Long id)  {
        return  ZHOpenJdbcUtil.executeUpdate(deleteById,id);
    }

}
